

*-------------------------- Set up the environment ---------------------------*
clear
use ../data/fiscal_dependence.dta
merge 1:1 city_id year using ../data/connection

*** Generating variables ***  
	gen reform_time = reform_50_year - pro_wave
	replace reform_time=5 if reform_time > 4 & reform_time !=.
	bysort city_id: egen centralize=max(centralize_city50)
	gen mi_treatment= (reform_50_year==.)
	gen nonmi_ps = (connection_home0 != .  & connection_college0 != .  & connection_work0 != .  & connection_prom0 != .  & c_edu0 !=.  & age0 != .  & sex0 != .  & c_tenure0 != .  & c_firstyearml0 != .  & c_central_exp0 != . )
	gen nonmi_mayor = (connection_home1 != .  & connection_college1 != .  & connection_work1 != .  & connection_prom1 != .  & c_edu1 !=.  & age1 != .  & sex1 != .  & c_tenure1 != .  & c_firstyearml1 != .  & c_central_exp1 != . )
	gen nonmi_city = (gdp_percapita_c != . & population_hr_c != . & publicfinance_income_c != . & gdp_growth_c != . & city_total_ipo != . & tax_vadded_c != . & investment_fixed_c != . & population_unemployed_c != . & gdp_secondary_c != . & gdp_tertiary_c != . & publicfinance_expenditure_c != .)
	
*** Define control variables ***	
	global mayor_cont connection_home1 connection_college1 connection_work1 connection_prom1 c_edu1 age1 sex1 c_tenure1 c_firstyearml1 c_central_exp1

	global sec_cont connection_home0 connection_college0 connection_work0 connection_prom0 c_edu0 age0 sex0 c_tenure0 c_firstyearml0 c_central_exp0

	global city_cont population_hr_c gdp_percapita_c gdp_growth_c publicfinance_income_c publicfinance_expenditure_c city_total_ipo tax_vadded_c investment_fixed_c population_unemployed_c gdp_secondary_c gdp_tertiary_c 
				 
***sampling*** 				 
	keep if year == 2013
	
*-------------------------- Regression analysis -------------------------------*

***Table A1*** 

	eststo clear 
	stset reform_time, id(city_id) failure(centralize==1)  
	foreach x in $mayor_cont{
	eststo: qui stcox  `x' i.pro_code if nonmi_mayor == 1, strata(pro_code) nohr
}
	eststo: stcox  $mayor_cont i.pro_code , strata(pro_code) nohr
	esttab, se b(3) t(3) scalars(N_clust) star(* 0.1 ** 0.05 *** 0.01) keep($mayor_cont) 

***Table A2***

	eststo clear 
	stset reform_time, id(city_id) failure(centralize==1)  
	foreach x in $sec_cont{
	eststo: qui stcox  `x' i.pro_code if nonmi_ps == 1, strata(pro_code) nohr
}
	eststo: stcox  $sec_cont i.pro_code , strata(pro_code) nohr
	esttab, se b(3) t(3) scalars(N_clust) star(* 0.1 ** 0.05 *** 0.01) keep($sec_cont) 
	
***Table B1***

	winsor2 $city_cont, cut(1 99) replace
	eststo clear
	foreach x in $city_cont{
	eststo: qui reg mi_treatment `x' i.pro_code if nonmi_city == 1,  vce(cluster pro_code)   
}
	esttab , se b(3) t(3) scalars(N_clust) star(* 0.1 ** 0.05 *** 0.01) keep($city_cont) 

***Table B3*** 

	eststo clear 
	stset reform_time, id(city_id) failure(centralize==1)  
	foreach x in $city_cont{
	eststo: qui stcox  `x' i.pro_code if nonmi_city == 1, strata(pro_code) nohr
}
	eststo: stcox  $city_cont i.pro_code, strata(pro_code) nohr
	esttab, se b(3) t(3) scalars(N_clust) star(* 0.1 ** 0.05 *** 0.01) keep($city_cont) 
	

